/**
 * @ClassName SumTest
 * @Description 递归求和1 + 2 + 3 + ... + 10
 * @Author 李明忠
 * @Date 2025/5/17 23:10
 * @Version 1.0
 */
public class SumTest {
    public static void main(String[] args) {
        System.out.println(sum(10));
    }
    public static int sum(int n) {
        if (n == 1)
            return 1;
        else
            return n + sum(n - 1);
    }
}
